//
//  NoteInterventoViewController.m
//  InterventixApp
//
//  Created by Diego Falcinelli on 01/06/13.
//
//

#import "NoteInterventoViewController.h"

@interface NoteInterventoViewController ()

@end

@implementation NoteInterventoViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    if(![self.intervento.note isEqual:[NSNull null]]){
        self.oldNote = self.intervento.note;
        self.note.text = self.intervento.note;
    }else{
        self.oldNote = @"";
        self.note.text = @"";
    }
    self.titolo.text = [NSString stringWithFormat:@"Note dell'intervento %@",self.intervento.idintervento];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(IBAction) indietro{
	[[self navigationController] popViewControllerAnimated:YES];
    
}

-(IBAction) salva{
    self.intervento.note = self.note.text;
    [[self navigationController] popViewControllerAnimated:YES];
}

-(IBAction) ripristina{
    self.intervento.note = self.oldNote;
    self.note.text = self.intervento.note;
}

-(IBAction) chiudiTastiera{
    [self.note resignFirstResponder];
}
@end
